#ifndef __DRV_FPGA_SPI_H
#define __DRV_FPGA_SPI_H
#ifdef __cplusplus
  extern "C" {
#endif


#include "main.h"


// FCW = 2^32/(50_000_000)*f
#define FCW_CALCU(fx) (4294967296/50000000*fx*64)

// wr addr 
#define CMD_EN      128
#define CMD_FCW     129
#define CMD_RD_ADDR 130

// rd addr
#define CMD_Dout0   0
#define CMD_Dout1   1
#define CMD_Dout2   2
#define CMD_BUSY    3


void FPGA_SPI_Send(uint8_t cmd, uint32_t data);
uint32_t FPGA_SPI_Rece(uint8_t cmd);


#ifdef __cplusplus
  }
#endif
#endif /* __DRV_FPGA_SPI_H */